import java.util.Scanner;

/**
   Counts the number of digits with value 7 in the decimal 
   representation of the integer n
*/
public class CountSevens
{
   public static void main(String[] args)
   {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();

      // your work here
      int k;
      int count = 0;
      if(n<0)n=-n;
      while(n!=0)
      {
         k=n%10;
         n=n/10;
         if(k==7){
            count++;
         }
      }
      System.out.println(count);
   }
}